//
//  StoresCell.m
//  BMProject
//
//  Created by chris on 16/1/1.
//  Copyright © 2016年 BMProject. All rights reserved.
//

#import "StoresCell.h"
#import "DataModel.h"
#import "NSDate+Utils.h"
#import "StoresViewController.h"

@implementation StoresCell

- (void)awakeFromNib {
    // Initialization code
    self.backgroundColor = [UIColor colorWithRed:0.94 green:0.94 blue:0.94 alpha:1];
    UIView * backView = [[UIView alloc]initWithFrame:CGRectMake(10, 0, DEF_SCREEN_WIDTH-20, 130)];
    backView.backgroundColor = [UIColor whiteColor];
    backView.layer.cornerRadius = 5.0;
    backView.layer.masksToBounds = YES;
    [self.contentView insertSubview:backView atIndex:0];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setInfo:(StoresListModel *)info {
    if(info == nil){
        return;
    }
    self.nameLa.text      = [NSString ignoreEmptyStr:info.name];//申请名称
    if(IsStringEmpty(info.creatTime)){
        self.dateLa.text      = @"";//20151202111348  2015-12-1
    }else{
        self.dateLa.text      = [[NSDate dateWithString:info.creatTime formatString:@"yyyyMMddHHmmss"] formatStringWithFormat:@"yyyy-MM-dd"];//20151202111348  2015-12-1
    }
    self.statusLa.text    = [NSString ignoreEmptyStr:[self getSignNameFromid:info.sign.intValue]];//审核状态
    self.managerLa.text   = [NSString ignoreEmptyStr:info.servicer];//渠道经理
}

- (NSString *)getSignNameFromid:(NSInteger)signId {
    // sign==1 待审核  sign==2 渠道经理审核通过  sign==3 渠道经理审核驳回  sign==4  分公司审核通过  sign==5 分公司审核驳回  sign==6 签约完成
    if (signId  == 1) {
        return @"待审核";
    }
    if (signId  == 2) {
        return @"渠道经理审核通过";
    }
    if (signId  == 3) {
        return @"渠道经理审核驳回";
    }
    if (signId  == 4) {
        return @"分公司审核通过";
    }
    if (signId  == 5) {
        return @"分公司审核驳回";
    }
    if (signId  == 6) {
        return @"签约完成";
    }
    return @"";
}

@end
